package cn.edu.hbpu.service;

import cn.edu.hbpu.mapper.StudentMapper;
import cn.edu.hbpu.mapper.TeacherMapper;
import cn.edu.hbpu.pojo.Student;
import cn.edu.hbpu.pojo.StudentCustom;
import cn.edu.hbpu.pojo.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by yuwenteng on 2017/9/17.
 */
@Service("loginServiceImpl")
public class LoginServiceImpl implements LoginService {

    @Autowired
    private StudentMapper studentMapper;

    @Autowired
    private TeacherMapper teacherMapper;

    /**
     * @Author yuwenteng
     * @Date 2017/9/22 22:45
     * @Description 查询数据库学生信息，完成用户登录功能
     */
    public StudentCustom getStudentInfoByName(String stuName) {
        return studentMapper.selectStudentByStuName(stuName);
    }

    /**
     * @Author yuwenteng
     * @Date 2017/9/28 22:44
     * @Description 查询数据库老师信息，完成用户登录功能
     */
    public Teacher getTeacherInfoByName(String teacherName) {
        return teacherMapper.selectTeacherByStuName(teacherName);
    }

    /**
     * @Author yuwenteng
     * @Date 2017/10/12 22:16
     * @Description 查询用户权限信息
     */
    public Student findStudentPermissionInfo(String username) {
        return studentMapper.selectStudentInfo(username);
    }
}
